package com.kaifamiao.time;

import java.time.Instant;

public class InstantInstance {

    public static void main(String[] args) {

        Instant current = Instant.now();
        System.out.println( current );

        // 参数以毫秒为单位
        Instant x = Instant.ofEpochMilli( System.currentTimeMillis() );
        System.out.println( x );

        // 参数以秒为单位
        Instant y = Instant.ofEpochSecond( 60 * 60 * 24 * 365 * 50 );
        System.out.println( y );

        Instant z = Instant.ofEpochSecond( 60 * 60 * 24 * 365 * 50 , 100200300 );
        System.out.println( z );

        CharSequence text = "2007-12-03T10:15:30.00Z";
        // 通过解析 字符序列 得到一个 Instant实例
        Instant n = Instant.parse( text );
        System.out.println( n );

        System.out.println( "- ".repeat( 20 ) );

        System.out.println( Instant.MIN );
        System.out.println( Instant.MAX );
        System.out.println( Instant.EPOCH );

    }

}
